package ru.integrationmessagers.vk.config;


import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.DefaultUriBuilderFactory;
import ru.integrationmessagers.vk.config.properties.VkProperty;

@Configuration
@EnableConfigurationProperties({VkProperty.class})
public class VkConfiguration {

    @Bean
    public RestTemplate vkRestTemplate(VkProperty vkProperty) {
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.setUriTemplateHandler(new DefaultUriBuilderFactory(vkProperty.getHost()));
        return restTemplate;
    }

}
